package dao

import (
	"time"
)

// 这是 XxlJobInfo 的全局公开dao对象
var XxlJobInfoDao = xxlJobInfoDao{}

// 这是 xxl_job_info表 的实体类
type XxlJobInfo struct {
	Id                     int       `json:"id" form:"id" v:"id"`
	JobGroup               int       `json:"job_group" form:"job_group" v:"job_group"` // 执行器主键ID
	JobDesc                string    `json:"job_desc" form:"job_desc" v:"job_desc"`
	AddTime                time.Time `json:"add_time" form:"add_time" v:"add_time"`
	UpdateTime             time.Time `json:"update_time" form:"update_time" v:"update_time"`
	Author                 string    `json:"author" form:"author" v:"author"`                                                          // 作者
	AlarmEmail             string    `json:"alarm_email" form:"alarm_email" v:"alarm_email"`                                           // 报警邮件
	ScheduleType           string    `json:"schedule_type" form:"schedule_type" v:"schedule_type"`                                     // 调度类型
	ScheduleConf           string    `json:"schedule_conf" form:"schedule_conf" v:"schedule_conf"`                                     // 调度配置，值含义取决于调度类型
	MisfireStrategy        string    `json:"misfire_strategy" form:"misfire_strategy" v:"misfire_strategy"`                            // 调度过期策略
	ExecutorRouteStrategy  string    `json:"executor_route_strategy" form:"executor_route_strategy" v:"executor_route_strategy"`       // 执行器路由策略
	ExecutorHandler        string    `json:"executor_handler" form:"executor_handler" v:"executor_handler"`                            // 执行器任务handler
	ExecutorParam          string    `json:"executor_param" form:"executor_param" v:"executor_param"`                                  // 执行器任务参数
	ExecutorBlockStrategy  string    `json:"executor_block_strategy" form:"executor_block_strategy" v:"executor_block_strategy"`       // 阻塞处理策略
	ExecutorTimeout        int       `json:"executor_timeout" form:"executor_timeout" v:"executor_timeout"`                            // 任务执行超时时间，单位秒
	ExecutorFailRetryCount int       `json:"executor_fail_retry_count" form:"executor_fail_retry_count" v:"executor_fail_retry_count"` // 失败重试次数
	GlueType               string    `json:"glue_type" form:"glue_type" v:"glue_type"`                                                 // GLUE类型
	GlueSource             string    `json:"glue_source" form:"glue_source" v:"glue_source"`                                           // GLUE源代码
	GlueRemark             string    `json:"glue_remark" form:"glue_remark" v:"glue_remark"`                                           // GLUE备注
	GlueUpdatetime         time.Time `json:"glue_updatetime" form:"glue_updatetime" v:"glue_updatetime"`                               // GLUE更新时间
	ChildJobid             string    `json:"child_jobid" form:"child_jobid" v:"child_jobid"`                                           // 子任务ID，多个逗号分隔
	TriggerStatus          int       `json:"trigger_status" form:"trigger_status" v:"trigger_status"`                                  // 调度状态：0-停止，1-运行
	TriggerLastTime        int       `json:"trigger_last_time" form:"trigger_last_time" v:"trigger_last_time"`                         // 上次调度时间
	TriggerNextTime        int       `json:"trigger_next_time" form:"trigger_next_time" v:"trigger_next_time"`                         // 下次调度时间

}

// 注意:这是 XxlJobInfo 的私有dao对象
type xxlJobInfoDao struct {
	Insert func(arg XxlJobInfo) int        //插入一条记录
	Update func(arg XxlJobInfo) int        //更新一条记录
	Delete func(arg XxlJobInfo) int        //删除一条记录
	Select func(arg XxlJobInfo) XxlJobInfo //获取一条记录
}
